<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@include file="/include/public.jspf"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/m-base.css" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/m-common.css" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/p-all.css" />
<script type="text/javascript" src="${path }/js/jquery1.10.2.min.js"></script>
<script type="text/javascript" src="${path }/js/lib/zepto.js"></script>
<script type="text/javascript" src="${path }/js/common/base.js"></script>
<script src="${path }/js/helper.js?v=${v}"></script>
<script src="${path }/js/cookie.js?v=${v}"></script>
<script src="${path }/js/member/draw.js?v=${v}"></script>
<script src="${path }/js/member/bindCard.js?v=${v}"></script>

<title>魔环金融</title>
</head>
<body>
<div class="ui_title">
        <a class="ui_back" href="${path }/member/center.htm"><i class="ui_icon_back"></i>返回</a>
        提现</div>
    <div class="p_account_charge">
    <c:if test="${isBindCard eq '0'}">
      <div class="ui_bank_list mb10">
            <div style="font-size: 12px;color: red;">
            <span>很抱歉，您还没有绑定银行卡，暂时不能取现。</span>
           	<div class=" mb10"></div>
           	<div class=" mb10" style="padding-top:10px;">
            <a href="javascript:bindCard();" class="btn_charge">立即绑定银行卡</a>
            </div>
            </div>
        </div>
        </c:if>
        <c:if test="${isBindCard eq '1'}">
        <div id="carry_form">
            <div class="ui_bg_box mb10">
                <div class="charge_con">
                    <h2 class="f15">现金余额：<fmt:formatNumber value="${(account.baseMoney-account.freezeMoney)/100 }" pattern="0.00"></fmt:formatNumber> 元</h2>
                    <input type="hidden" value="<fmt:formatNumber value="${(account.baseMoney-account.freezeMoney)/100 }" pattern="0.00"/>" id="hidden_Jcarry_totalAmount"/>
                    
                    
                    <div class="ui_ipt">
                    	<input type="hidden" id="canDrawMoney" value="<fmt:formatNumber value="${(account.baseMoney-account.freezeMoney)/100 }" pattern="#0"></fmt:formatNumber>">
                        <input id="money" name="money" type="text" maxlength="9" placeholder="提现金额" class="ui_input" >
                    </div>
                                        <div class="tips gray_v1">预计<span class="red_v1">1个工作日</span>内到账，实际到账依据账户托管方及提现银行而有所差异</div>
                                    </div>
            </div>
            <div class="ui-deal-btn mb10">
                <input type="button" onclick="draw()" value="确认提现" class="ui_btn_red" >
            </div>
        </div>
        </c:if>
    </div>
<script>
var _inCarryRequest = false;
var remain = 0.00 * 1;
function upateSubmitButton() {
    var disabled = _inCarryRequest || $('#money').val() == '';
    if (disabled) {
        $('#login_btn').attr('disabled', 'disabled').css('color','#f3b7af');
    } else {
        $('#login_btn').removeAttr('disabled').css('color','#fff');
    }
}
$('#money').bind("input", upateSubmitButton);
var _upateSubmitButtonCount = 10;
var _upateSubmitButtonTimer = setInterval(function(){
    upateSubmitButton();
    _upateSubmitButtonCount--;
    if (_upateSubmitButtonCount < 0) {
        clearInterval(_upateSubmitButtonTimer);
    }
}, 300);
$('#login_btn').click(function(){
    if(_inCarryRequest) return;
    var money = $.trim($('#money').val());
    $('#money').val(money);
    upateSubmitButton();
    if (!(money >= 0)) {
        P2PWAP.ui.toast('提现金额为整数或小数，小数点后不超过2位。');
    } else if (money == 0 ){
        P2PWAP.ui.toast('提现金额不能低于0.01元');
    } else if (/^[\.+]/.test(money) || /\.$/.test(money) || /\.(\d){3,}/.test(money) ){
        P2PWAP.ui.toast('提现金额为整数或小数，小数点后不超过2位。');
    } else if (money > remain){
        P2PWAP.ui.toast('现金余额不足');
    } else {
        _inCarryRequest = true;
        P2PWAP.util.request('/account/ajax_carry', function(data){
            _inCarryRequest = false;
            upateSubmitButton();
            window.location.href = '/account/carrysuc';
        },function(msg){
            _inCarryRequest = false;
            upateSubmitButton();
            P2PWAP.ui.toast(msg);
        },'get',{
            'money': money
        });
    }
});
</script>
</body>
</html>